package com.example.navigationsample

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.standard.navigation.NavigationView
import com.standard.navigation.bean.NavigationBean
import java.util.ArrayList

class MainActivity : AppCompatActivity() {
    private lateinit var nvView: NavigationView
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        nvView = findViewById(R.id.nv_view)
        initView()
    }

    private fun initView() {
        nvView.setNavigationBG(R.color.bg_interface)
        val list: MutableList<NavigationBean> = ArrayList<NavigationBean>()
        list.apply {
            add(
                NavigationBean(
                    TestFragment("首页"),
                    "首页",
                    R.drawable.icon_first_page_dark,
                    R.drawable.icon_first_page_light
                )
            )

            add(
                NavigationBean(
                    TestFragment("地块"),
                    "地块",
                    R.drawable.icon_farm_dark,
                    R.drawable.icon_farm_light
                )
            )

            add(
                NavigationBean(
                    TestFragment("农事"),
                    "农事",
                    R.drawable.icon_farm_task_dark,
                    R.drawable.icon_farm_task_light
                )
            )

            add(
                NavigationBean(
                    TestFragment("加工"),
                    "加工",
                    R.drawable.icon_make_dark,
                    R.drawable.icon_make_light
                )
            )

            add(
                NavigationBean(
                    TestFragment("我的"),
                    "我的",
                    R.drawable.icon_my_dark,
                    R.drawable.icon_my_light
                )
            )
        }
        //设置导航栏fragment
        nvView.setNavigationPager(supportFragmentManager, list)
        //设置分割线颜色
        nvView.setLineColor(R.color.lineColor)
        //设置文字选中和未选中的颜色
        nvView.setNavigationTextColor(R.color.checked, R.color.unchecked)
        //设置通知，圆点显示
        nvView.showNotify(0)
        //设置通知数字显示
        nvView.showNotify(1, 101)
    }
}